<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
	</body>
	<script>
	//正序
		var arr = [11, 55, 22, 44, 88, 99, 66]
		for(var i = 1; i < arr.length; i++) {
			for(var j = 0; j < arr.length - i; j++) {
				if(arr[j] > arr[j + 1]) {
					var a = arr[j]
					arr[j] = arr[j + 1];
					arr[j + 1] = a
				}
			}
		}
		document.write("正序:"+arr + "<br />")
		var arr1 = [11, 55, 22, 44, 88, 99, 66]
		for(var i = 0; i < arr1.length - 1; i++) {
			for(var j = i + 1; j < arr1.length; j++) {
				if(arr1[j] > arr1[i]) {
					var temp = arr1[i];
					arr1[i] = arr1[j];
					arr1[j] = temp;
				}
			}
		}
		document.write("反序:"+arr1 + "<br />")
	</script>
</html>